/**
 * Copyright 2014 opencxa.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.cxa.rpc.cloud.server.components.authentication;

import org.cxa.misc.sqLiteUtils.SqLiteTableColumn;
import org.cxa.misc.sqLiteUtils.SqLiteTableColumn.DataType;
import org.cxa.misc.sqLiteUtils.SqLiteTableColumn.Modifier;

import com.google.gson.annotations.Expose;

/**
 * @author Christopher Armenio
 *
 */
public class Group
{
	public static final String FIELD_NAME_ID = "id";
	
	@SqLiteTableColumn(dataType = DataType.INTEGER, modifiers = {Modifier.PRIMARY_KEY, Modifier.AUTO_INCREMENT, Modifier.NOT_NULL}) @Expose
	private Integer id;
	@SqLiteTableColumn(dataType = DataType.TEXT, modifiers = {Modifier.NOT_NULL}) @Expose
	private String name;
	
	
	/*
	 * required for SqLiteTableColumn instantiation 
	 */
	public Group() { }
	
	
	public Group(String nameIn)
	{
		this.id = null;
		this.name = nameIn;
	}
	
	
	public Group(Integer idIn, String nameIn)
	{
		this.id = idIn;
		this.name = nameIn;
	}
	
	
	public Integer getId()
	{
		return this.id;
	}
	
	
	public String getName()
	{
		return this.name;
	}
	
	
	@Override
    public boolean equals(Object objectIn)
    {
		return (objectIn instanceof Group) ? (((Group)objectIn).id == this.id) : false;
    }
}
